﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using BudgetManager.Domain;
using Microsoft.Phone.Shell;

namespace BudgetManager
{
    public partial class EditAccount : PhoneApplicationPage
    {
        Account account;
        public EditAccount()
        {
            InitializeComponent();
            account = AccountManager.SelectedAccount;

            txtName.Text = account.Name;
            txtDescription.Text = account.Description;
            txtPin.Text = account.Pin;
            txtRepeatPin.Text = account.Pin;

        }

        private void onOkClick(object sender, EventArgs e)
        {

            AccountManager.EditAccount(account.Id,txtName.Text, txtDescription.Text,txtPin.Text);
            NavigationService.Navigate(new Uri(string.Format("/Settings.xaml?"), UriKind.Relative));
        }
    }
}